//
//  Manager.h
//  diaoyuren
//
//  Created by 钓鱼人 on 15/12/19.
//  Copyright © 2015年 game. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "DIEError.h"
typedef void (^CompletionType)(id responseObject,DIEError *error);

typedef void (^ListAndComent)(id list,id recomment,id pageInfo,id fourth_classify);
typedef void (^CharctAry)(id Charact);
typedef void (^GetError)(DIEError *error);
typedef void (^ToSQL)();
typedef void (^CityBlock)(id Model,id Citys);

@interface Manager : NSObject
+(instancetype)sharedManager;

/**
 *  首页每日精选数据请求
 */
-(void)AchiveMainpageSectionDataWhithCompletionType:(CompletionType)comple ToSQL:(ToSQL)toSQL;

-(void)ResponseWhithURL:(NSString *)url AndParameter:(NSDictionary *)params AndCompletionType:(CompletionType)completion;

-(void)RequestWhithURL:(NSString *)url AndParameter:(NSDictionary *)params AndCompletionType:(CompletionType)completion;

-(void)CityDataFromSQL:(CityBlock)CityBlock;
- (void)CityNameToPingYinCityAry:(NSArray *)cityAry Result:(ListAndComent)result;

-(void)AchiveMainPageDataWhithToSQl:(ToSQL)toSQL;

-(void)AchiveDataOfSchoolTypeid:(NSInteger )ttypeid Page:(NSInteger )page SQLTablePath:(NSString *)path tableName:(NSString *)table AndDataAry:(NSMutableArray *)dataAry AndResult:(ListAndComent)listAndRecomment AError:(GetError )getError;

-(void)AchiveCharactWhithTypeid:(NSInteger )ttypeid AndTablePath:(NSString *)tabelPath TableName:(NSString *)tableName AndResult:(CharctAry)CharctResult Error:(GetError)getError;

-(void)AchiveBigAndSmallCharectWhithUrl:(NSString *)url AndResult:(ListAndComent)listAndRecomment AError:(GetError )getError;

+(NSString *)GetTimeWhithTimesMark:(NSInteger )timesp;

+(void)GetHudWhithText:(NSString *)text AndFatherView:(UIView *)fatherView;

+(NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString;

+(NSString*)doDecEncryptStr:(NSString *)encryptStr withKey:(NSString*)key;

+ (NSString*)doEncryptStr:(NSString*)plainText withKey:(NSString*)key;
+(UIImageView *) makeRotation:(UIImageView *)image speedX:(float)X speedY:(float)Y;

+(CGFloat )CountTextWhithSize:(CGSize)size AndString:(NSString *)str AndfFontSize:(CGFloat)X;


/**
 *  压缩图片
 */
+ (UIImage *)imageByScalingToMaxSize:(UIImage *)sourceImage WhithMAXWIdth:(CGFloat )width;

/**
 *  将相片旋转到正确位置（我们想要的竖屏样子）
 */
+ (UIImage *)fixOrientation:(UIImage *)aImage;

/**
 *  //判断设备是否有摄像头
 */
+ (BOOL) isCameraAvailable;

/**
 * 后面的摄像头是否可用
 */
+ (BOOL) isRearCameraAvailable;

/**
 * 检查摄像头是否支持拍照
 */
+ (BOOL) doesCameraSupportTakingPhotos;

/**
 *  相册是否可用
 */
+ (BOOL) isPhotoLibraryAvailable;

/**
 *  是否可以在相册中选择视频
 */
+ (BOOL) canUserPickVideosFromPhotoLibrary;
/**
 *  是否可以在相册中选择视频
 */
+ (BOOL) canUserPickPhotosFromPhotoLibrary;
/**
 * 通过城市名字在数据库获取整条数据 返回字典
 */
+(NSDictionary *)WeathcityFromSQl:(NSString *)cityname;

/**
 * 计算 textView内容的高度
 */
+(CGFloat )textViewCounthight:(UITextView *)textView;

/**
 *  获取当前的时间
 *
 *  @return 日-月 时：分
 */
+(NSString *)AchiveNowTime;

+(void)CityLocalAndPinYFromSQlWhithCityName:(NSString *)cityName AndIsNotificayion:(BOOL)isNotificayion;

/**
 *  指定尺寸  压缩图片大小
 */
+(UIImage *) imageCompressForSize:(UIImage *)sourceImage targetSize:(CGSize)size;
+(UIImage *) imageCompressForWidth:(UIImage *)sourceImage targetWidth:(CGFloat)defineWidth;

//草稿箱存储地址
+(NSString *)editeFilePath;


/**
 *  天气的城市，本地数组
 */
+(NSString *)CityAryPath;

+(UIView *)textFileLweftView;

+(NSString *)ret8bitString;
@end
